import { put, takeEvery, delay, call } from 'redux-saga/effects'
import axios from 'axios'

function * rootSaga() {
    // 把+1写成异步的方式
    yield takeEvery('SAGA_ADD', addCount)
}


function * addCount() {
    // put   store.dispatch
    // yield delay(2000)
    let res = yield call(axios.get, "/getNum")
    res = res.data
    yield put({ type: "ADD", res })
}

export default rootSaga